home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / dev / obero / Interfaces3_6.lha / Interfaces / SCSIDisk.mod < prev    next >
Encoding:
Text File  |  1994-03-06  |  4.8 KB  |  118 lines

  1. (*
  2. (*
  3. **  Amiga Oberon Interface Module:
  4. **  $VER: SCSIDisk.mod 40.15 (28.12.93) Oberon 3.0
  5. **
  6. **   © 1993 by Fridtjof Siebert
  7. *)
  8. *)
  9.  
  10. MODULE SCSIDisk;   (* $Implementation- *)
  11.  
  12. IMPORT e * := Exec;
  13.  
  14. (*--------------------------------------------------------------------
  15.  *
  16.  *   SCSI Command
  17.  *      Several Amiga SCSI controller manufacturers are converging on
  18.  *      standard ways to talk to their controllers.  This include
  19.  *      file describes an exec-device command (e.g. for hddisk.device)
  20.  *      that can be used to issue SCSI commands
  21.  *
  22.  *   UNIT NUMBERS
  23.  *      Unit numbers to the OpenDevice call have encoded in them which
  24.  *      SCSI device is being referred to.  The three decimal digits of
  25.  *      the unit number refer to the SCSI Target ID (bus address) in
  26.  *      the 1's digit, the SCSI logical unit (LUN) in the 10's digit,
  27.  *      and the controller board in the 100's digit.
  28.  *
  29.  *      Examples:
  30.  *                0     drive at address 0
  31.  *               12     LUN 1 on multiple drive controller at address 2
  32.  *              104     second controller board, address 4
  33.  *               88     not valid: both logical units and addresses
  34.  *                      range from 0..7.
  35.  *
  36.  *   CAVEATS
  37.  *      Original 2090 code did not support this command.
  38.  *
  39.  *      Commodore 2090/2090A unit numbers are different.  The SCSI
  40.  *      logical unit is the 100's digit, and the SCSI Target ID
  41.  *      is a permuted 1's digit: Target ID 0..6 maps to unit 3..9
  42.  *      (7 is reserved for the controller).
  43.  *
  44.  *          Examples:
  45.  *                3     drive at address 0
  46.  *              109     drive at address 6, logical unit 1
  47.  *                1     not valid: this is not a SCSI unit.  Perhaps
  48.  *                      it's an ST506 unit.
  49.  *
  50.  *      Some controller boards generate a unique name (e.g. 2090A's
  51.  *      iddisk.device) for the second controller board, instead of
  52.  *      implementing the 100's digit.
  53.  *
  54.  *      There are optional restrictions on the alignment, bus
  55.  *      accessability, and size of the data for the data phase.
  56.  *      Be conservative to work with all manufacturer's controllers.
  57.  *
  58.  *------------------------------------------------------------------*)
  59.  
  60. CONST
  61.  
  62.   scsiCmd * = 28;               (* issue a SCSI command to the unit *)
  63.                                 (* io_Data points to a SCSICmd *)
  64.                                 (* io_Length is sizeof(struct SCSICmd) *)
  65.                                 (* io_Actual and io_Offset are not used *)
  66.  
  67. TYPE
  68.  
  69.   SCSICmdPtr * = UNTRACED POINTER TO SCSICmd;
  70.   SCSICmd * = STRUCT
  71.     data * : e.APTR;          (* word aligned data for SCSI Data Phase *)
  72.                               (* (optional) data need not be byte aligned *)
  73.                               (* (optional) data need not be bus accessable *)
  74.     length * : LONGINT;       (* even length of Data area *)
  75.                               (* (optional) data can have odd length *)
  76.                               (* (optional) data length can be > 2**24 *)
  77.     actual * : LONGINT;       (* actual Data used *)
  78.     command * : e.APTR;       (* SCSI Command (same options as scsi_Data) *)
  79.     cmdLength * : INTEGER;    (* length of Command *)
  80.     cmdActual * : INTEGER;    (* actual Command used *)
  81.     flags * : SHORTSET;       (* includes intended data direction *)
  82.     status * : SHORTINT;      (* SCSI status of command *)
  83.     senseData * : e.APTR;     (* sense data: filled if SCSIF_[OLD]AUTOSENSE *)
  84.                               (* is set and scsi_Status has CHECK CONDITION *)
  85.                               (* (bit 1) set *)
  86.     senseLength * : INTEGER;  (* size of scsi_SenseData, also bytes to *)
  87.                               (* request w/ SCSIF_AUTOSENSE, must be 4..255 *)
  88.     senseActual * : INTEGER;  (* amount actually fetched (0 means no sense) *)
  89.   END;
  90.  
  91.  
  92. CONST
  93.  
  94. (*----- scsi_Flags -----*)
  95.   write         * = SHORTSET{};       (* intended data direction is out *)
  96.   read          * = 0;                (* intended data direction is in *)
  97.   readWrite     * = 0;                (* (the bit to test) *)
  98.  
  99.   noSense       * = SHORTSET{};       (* no automatic request sense *)
  100.   autoSense     * = 1;                (* do standard extended request sense *)
  101.                                       (* on check condition *)
  102.   oldAutoSense  * = 2;                (* do 4 byte non-extended request *)
  103.                                       (* sense on check condition *)
  104.  
  105. (*----- SCSI io_Error values -----*)
  106.   selfUnit      * = 40;     (* cannot issue SCSI command to self *)
  107.   dma           * = 41;     (* DMA error *)
  108.   phase         * = 42;     (* illegal or unexpected SCSI phase *)
  109.   parity        * = 43;     (* SCSI parity error *)
  110.   selTimeout    * = 44;     (* Select timed out *)
  111.   badStatus     * = 45;     (* status and/or sense error *)
  112.  
  113. (*----- OpenDevice io_Error values -----*)
  114.   noBoard       * = 50;     (* Open failed for non-existant board *)
  115.  
  116. END SCSIDisk.
  117.  
  118.